package com.bpf.base.util;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;

public class SpringSecurityUtil {

	/**
	 * 获得当前登陆用户对应的对象。
	 * @return UserDetails
	 */
	public static UserDetails getPrincipal(){
		return (UserDetails) SecurityContextHolder.getContext()  
				  .getAuthentication().getPrincipal(); 
	}

}
